import http from '@/utils/http'

export function menuApi(data, params) {
  return http.request({
    url: '/api/menu/getAll',
    method: 'POST',
    data,
    params
  })
}

export function menuDeleteApi(_id) {
  return http.request({
    url: `/api/menu/${_id}`,
    method: 'DELETE',
  })
}

export function menuDetailApi(_id) {
  return http.request({
    url: `/api/menu/${_id}`,
    method: 'GET',
  })
}

export function menuAddApi(data) {
  return http.request({
    url: `/api/menu`,
    method: 'POST',
    data,
  })
}

export function menuUpsertApi(data) {
  return http.request({
    url: `/api/menu/${data?.id}`,
    method: 'PUT',
    data,
  })
}

export function menuTreeApi() {
  return http.request({
    url: `/api/menu/tree`,
    method: 'GET',
  })
}